<template>
  <div>
    <vExcel/>
  </div>
</template>

<script>
import vExcel from '../../excel/uploadExcel'
export default {
  components: { vExcel },
  data() {
    return {
      onlyOneChild: null,
      url: 'https://tuitui.wxtt.cn/#/'
    }
  },
  created() {
    // console.log(this.$router.options.routes,'created');
    // this.buildTreeNode(this.$router.options.routes)
  },
  methods: {
    buildTreeNode(arr) {
      let arr1 = [], obj = {}
      const arr2 = arr.filter((item, index) => {
        if (item.hidden) {
          return false
        } else {
          return true
        }
      })
      console.log(arr2)
      arr2.forEach((item, index) => {
        console.log(111)
        const children = item.children !== 'undefined' && item.children.filter(item => {
          console.log(item, 'children')
          if (item.hidden) {
            return false
          }
          return true
        })
        if (children && children.length > 0) {
          console.log(item, 'item.meta')
          obj.label = item.meta.title
          obj.key = JSON.stringify(item)
          obj.children = this.buildTreeNode(item.children)
          arr1.push(obj)
        } else {
          obj.label = item.meta.title + this.url + item.meta.fullPath
          obj.key = JSON.stringify(item)
          return arr1.push(obj)
        }
      })
      console.log(arr1, 'digui')
      return arr1
    }
  }
}
</script>

<style scoped>

</style>
